package com.mba.adapter;

import java.util.ArrayList;

import com.mba.activity.R;
import com.mba.bean.ContentInfo;
import com.mba.util.AsyncImageLoader;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ConversationActivityAdapter extends BaseAdapter{
	private Context context;
	private ArrayList<ContentInfo> contentList;
	private AsyncImageLoader imageLoader;
	public ConversationActivityAdapter(Context context, ArrayList<ContentInfo> contentList) {
		this.context=context;
		this.contentList = contentList;
		imageLoader=new AsyncImageLoader();
	}

	@Override
	public int getCount() {
		return contentList!=null?contentList.size():0;
	}
	
	@Override
	public Object getItem(int arg0) {
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		return 0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		if(arg1==null){
			arg1=LayoutInflater.from(context).inflate(R.layout.conversation_listview_item, null);
		}
		final ImageView avater = (ImageView) arg1.findViewById(R.id.conversation_list_item_avatar);
		TextView name = (TextView) arg1.findViewById(R.id.conversation_list_item_name);
		TextView area = (TextView) arg1.findViewById(R.id.conversation_list_item_area);
		final ContentInfo info = contentList.get(arg0);
		name.setText(info.getUserName());
		return arg1;
	}

}
